﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="SmtpResponse.cs" company="Martin Woodward">
//   Copyright (c) 2010 All Rights Reserved, Martin Woodward
//
//   This source is subject to the Apache 2.0 License
//   Please see the License.txt file for more information.
//   All other rights reserved.
//
//   THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY 
//   KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
//   IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
//   PARTICULAR PURPOSE.
// </copyright>
// <summary>
//   SMTP response container.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace nDumbster.smtp
{
    /// <summary>
    /// SMTP response container.
    /// </summary>
    internal class SmtpResponse
    {
        /// <summary>
        /// Response code - see RFC-2821. 
        /// </summary>
        private readonly int code;

        /// <summary>
        /// Response message. 
        /// </summary>
        private readonly string message;

        /// <summary>
        /// New state of the SMTP server once the request has been executed. 
        /// </summary>
        private readonly SmtpState nextState;

        /// <summary>
        /// Initializes a new instance of the <see cref="SmtpResponse"/> class. 
        /// </summary>
        /// <param name="code">
        /// The response code
        /// </param>
        /// <param name="message">
        /// The response message
        /// </param>
        /// <param name="nextState">
        /// The next state to change to.
        /// </param>
        public SmtpResponse(int code, string message, SmtpState nextState)
        {
            this.code = code;
            this.message = message;
            this.nextState = nextState;
        }

        /// <summary> 
        /// Gets the response code.
        /// </summary>
        public virtual int Code
        {
            get
            {
                return this.code;
            }
        }
        
        /// <summary> 
        /// Gets the response message.
        /// </summary>
        public virtual string Message
        {
            get
            {
                return this.message;
            }
        }

        /// <summary>
        /// Gets the next SMTP server state.
        /// </summary>
        public virtual SmtpState NextState
        {
            get
            {
                return this.nextState;
            }
        }
    }
}
